﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Carriers.aspx.cs" Inherits="Client_Revenue.Carriers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>
        Carrier List</h2>
        <div  style="float: left; margin-right: 20px; vertical-align:top;">
    <asp:EntityDataSource ID="CarrierEntityDataSource" runat="server" 
        ConnectionString="name=dominiumEntities" 
        DefaultContainerName="dominiumEntities" EnableFlattening="False" 
        EntitySetName="Carriers" EntityTypeFilter="Carrier" 
        Select="it.[CarrierId], it.[CarrierName], it.[AddressId]"  AutoGenerateOrderByClause="True" Where="" AutoGenerateWhereClause="True">
            <OrderByParameters>
                <asp:Parameter DefaultValue="CarrierId" />
                <asp:Parameter Name="AddressId" />
            </OrderByParameters>
    </asp:EntityDataSource>
    <asp:GridView ID="CarrierGridView" runat="server" AllowPaging="True" 
        AllowSorting="True" DataSourceID="CarrierEntityDataSource" 
                AutoGenerateColumns="False"  CssClass="datagrid"
                onselectedindexchanged="CarrierGridView_SelectedIndexChanged" 
                DataKeyNames="CarrierId,CarrierName">
        <Columns>
            <asp:CommandField ShowSelectButton="True" />
            <asp:BoundField DataField="CarrierName" HeaderText="Carrier" SortExpression="CarrierName" />
        </Columns>
         <SelectedRowStyle BackColor="LightGray"></SelectedRowStyle>
    </asp:GridView>
    </div>
    <asp:Panel ID="pnAddress" runat="server" Visible="false">
    <div>
   <%-- <h2>
    <asp:Label ID="lblCarrier" runat="server" Text=""></asp:Label></h2>
        <h3>
            Selected Carrier's Address</h3>--%>
        <asp:EntityDataSource ID="CarrierAddressEntityDataSource" runat="server" EnableFlattening="False"
            EntitySetName="Addresses" ConnectionString="name=dominiumEntities" DefaultContainerName="dominiumEntities"
            Select="it.[AddressId], it.[Line1], it.[Line2], it.[Line3], it.[City], it.[State], it.[Zip], it.[URL]"
            Where="it.[AddressId] = @AddressId" AutoGenerateOrderByClause="True">
            <OrderByParameters>
                <asp:Parameter DefaultValue="AddressId" />
            </OrderByParameters>
            <WhereParameters>
                <asp:ControlParameter ControlID="CarrierGridView" Type="Int32" Name="AddressId" PropertyName="SelectedValue" />
            </WhereParameters>
        </asp:EntityDataSource>
        <asp:GridView ID="CarrierAddressGridView" runat="server" DataSourceID="CarrierAddressEntityDataSource"  CssClass="datagrid"
            AutoGenerateColumns="False" SelectedRowStyle-BackColor="LightGray" DataKeyNames="AddressId">
            <EmptyDataTemplate>
                <p>
                    No Address found.</p>
            </EmptyDataTemplate>
            <Columns>
                <asp:CommandField ShowSelectButton="True" />
                <asp:CommandField ShowEditButton="True" />
                <asp:TemplateField HeaderText="Line 1" SortExpression="Line1">
                    <EditItemTemplate>
                        <asp:TextBox ID="txtLine1" runat="server" Width="200" Text='<%# Bind("Line1") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("Line1") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Line 2" SortExpression="Line2">
                    <EditItemTemplate>
                        <asp:TextBox ID="txtLine2" runat="server" Width="50px" Text='<%# Eval("Line2") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("Line2") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Line 3" SortExpression="Line3">
                    <EditItemTemplate>
                        <asp:TextBox ID="Label3" runat="server" Width="30px" Text='<%# Bind("Line3") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label3" runat="server" Text='<%# Bind("Line3") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="City" SortExpression="City">
                    <EditItemTemplate>
                        <asp:TextBox ID="Label4" runat="server" Text='<%# Eval("City") %>' Width="75"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label4" runat="server" Text='<%# Bind("City") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="State" SortExpression="State">
                    <EditItemTemplate>
                        <asp:TextBox ID="Label5" runat="server" Text='<%# Eval("State") %>' Width="20"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label5" runat="server" Text='<%# Bind("State") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Zip" SortExpression="Zip">
                    <EditItemTemplate>
                        <asp:TextBox ID="Label6" runat="server" Text='<%# Eval("Zip") %>' Width="40"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label6" runat="server" Text='<%# Bind("Zip") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="URL" SortExpression="URL">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox" runat="server" Text='<%# Eval("URL") %>' Width="100"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label7" runat="server" Text='<%# Bind("URL") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <SelectedRowStyle BackColor="LightGray"></SelectedRowStyle>
        </asp:GridView>
    </div>
    </asp:Panel>
    <div>
        
    </div>

</asp:Content>
